Product of Digits
TIME LIMIT = 1 SEC.
- The natural numbers begin from 1 and go on up to ∞.
Given N indices, find the product of the digits that lie on those indices.
NOTE:- Consider that the natural numbers are zero-indexed i.e. the index of the first number in the set of natural numbers is 0, the index of the second number is 1 and so on.
- Consider that all the natural numbers are written like a string '1234567891011121314….'
Now, let D be a function that takes an index as it's input and returns the digit that lies on that index.
D(0)=1;D(1)=2;D(2)=3 and so on…
Input | Output |
First line will contain N, number of indices. Second line will contain the Ni indices, each separated by a space. |
Print the product of the digits that lie on those indices. |
- 1 ≤ N ≤ 10
- 1 ≤ Ni ≤ 1000